//
//  SEGMainViewController.m
//  SEGUhomeStandard
//
//  Created by 刘山 on 2018/4/13.
//  Copyright © 2018年 刘山. All rights reserved.
//

#import "SEGMainViewController.h"

CFAbsoluteTime StartTime;
@interface SEGMainViewController ()<UIScrollViewDelegate>
@end

@implementation SEGMainViewController
#pragma mark - life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initNotification];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self segIsSign];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    //判断是否显示活动抽奖气泡 必须放在viewDidAppear里，否则有可能判断当前界面的时候失败
    [self seg_checkActivityLotteryBubble];
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [[SEGUhomeMediator sharedInstance] seg_hiddenActivitySignBubble:nil];
    [[SEGUhomeMediator sharedInstance] seg_hiddenActivityLotteryBubble:nil];
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter]removeObserver:self];
}

#pragma mark - init
- (void)initNotification {
    //收到活动抽奖推送
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(seg_checkActivityLotteryBubble)
                                                 name:SEGActivityLotteryNotification
                                               object:nil];
}

#pragma mark - send request
//请求活动签到气泡是否显示
- (void)segIsSign {
    [[SEGUhomeMediator sharedInstance] seg_checkActivitySignBubble:@{@"nav" : self.navigationController, @"view" : self.view}];
}

/// 判断是否显示活动抽奖气泡
- (void)seg_checkActivityLotteryBubble {
    [[SEGUhomeMediator sharedInstance] seg_checkActivityLotteryBubble:@{@"vc" : self}];;
}
@end
